//文件processimage.c，用以替换进程映像的程序
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
	
void printpos(char* string, int fildes)
{
	long pos;
	if((pos = lseek(fildes, 0L, 1)) < 0L);
	printf("%s: %ld\n", string, pos);
}

int main(int argc,char *argv[])
{
	int i;
	int fd = (int)argv[0];

	printpos("Child process read", fd);
 
	// printf("I am a process image!\n");
	// printf("ProcessImage:pid = %d, parentpid = %d\n", getpid(), getppid());
	// printf("ProcessImage:uid = %d,gid = %d\n", getuid(), getgid());
	
	for(i=0; i< argc; i++)
		printf("argv[%d]:%s\n",i ,argv[i]);
}
